//
// Source code recreated from a .class file by IntelliJ IDEA
// (powered by FernFlower decompiler)
//

package 力扣.题库.未分类.demo60AND80;

public class demo_66 {
    public demo_66() {
    }

    public int[] plusOne(int[] digits) {
        int i = digits.length - 1;

        for(int var10002 = digits[i]++; i > 0 && digits[i] == 10; --i) {
            digits[i] = 0;
            ++digits[i - 1];
        }

        if (digits[i] == 10) {
            int[] res = new int[digits.length + 1];
            res[0] = 1;
            digits[i] = 0;
            System.arraycopy(digits, 0, res, 1, digits.length);
            return res;
        } else {
            return digits;
        }
    }
}
